package com.fare.taluo.vo.core;

import java.text.SimpleDateFormat;
import java.util.Date;

@SuppressWarnings("serial")
public class AirlineEntityVO {

	private Long id;// 表主键，自增长
	private String source;// 航班起点
	private String dest;// 航班终点
	private String company;// 航班公司
	private String voyage;// 航程
	private String fightNo;// 航班
	private String departTime;// 起飞时间

	public AirlineEntityVO() {// 无参构造函数

	}

	public AirlineEntityVO(Long id, String source, String dest, String company,
			String voyage, String fightNo, String departTime) {
		this.id = id;
		this.source = source;
		this.departTime = departTime;
		this.fightNo = fightNo;
		this.company = company;
		this.dest = dest;
		this.voyage = voyage;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public String getDest() {
		return dest;
	}

	public void setDest(String dest) {
		this.dest = dest;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getVoyage() {
		return voyage;
	}

	public void setVoyage(String voyage) {
		this.voyage = voyage;
	}

	public String getFightNo() {
		return fightNo;
	}

	public void setFightNo(String fightNo) {
		this.fightNo = fightNo;
	}

	public String getDepartTime() {
		return departTime;
	}

	public void setDepartTime(String departTime) {
		this.departTime = str2Date(departTime);
	}

	// 格式化前台传来的日期数据，若抛出异常，则格式化当日
	public static String str2Date(String date) {

		SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm");

		String result;

		try {

			result = fmt.format(fmt.parse(date));
		} catch (Exception e) {
			// 若格式化日期错误，则返回当日时间
			Date now = new Date();
			result = fmt.format(now);
		}
		return result;

	}

}
